package com.uzai.console.web.wechatprivate;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.wechatprivate.wxq.wxgroupblacklist.blacklistprv.WxqBlacklistPrvIdDto;
import com.uzai.console.dto.wechatprivate.wxq.wxgroupkickwhitelist.WxqKickWhitelistDto;
import com.uzai.console.dto.wechatprivate.wxq.wxgroupkickwhitelist.WxqKickWhitelistIdDto;
import com.uzai.console.dto.wechatprivate.wxq.wxgroupkickwhitelist.WxqKickWhitelistQuery;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.wechatprivate.WxqKickWhitelistService;
import com.uzai.console.vo.wechatprivate.wxq.wxgroupkickwhitelist.WxqKickWhitelistVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 社群踢人白名单
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "社群踢人白名单",tags = "个人微信|社群踢人白名单")
@ApiSort(5)
@RestController
public class WxqKickWhitelistController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(WxqKickWhitelistController.class);

    @Autowired
    private WxqKickWhitelistService wxqKickWhitelistService;

    @ApiOperation(value = "分页查询社群踢人白名单列表", notes = "分页查询社群踢人白名单列表", response = WxqKickWhitelistVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/wxqKickWhitelist/findByPage")
    public Object findWxqKickWhitelistList(@RequestBody WxqKickWhitelistQuery wxqKickWhitelistQuery){
        return wxqKickWhitelistService.findByPage(wxqKickWhitelistQuery);
    }

    @SystemLogType(model = SystemModelEnum.WxqKickWhitelist, type = OperationTypeEnum.ADD)
    @ApiOperation(value = "添加社群踢人白名单", notes = "添加社群踢人白名单")
    @ApiOperationSupport(order = 2)
    @PostMapping("/wxqKickWhitelist/add")
    public Object addWxqBlacklistPrv(@RequestBody WxqKickWhitelistDto wxqKickWhitelistDto){
        wxqKickWhitelistService.add(wxqKickWhitelistDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.WxqKickWhitelist, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "移除社群踢人白名单", notes = "移除社群踢人白名单")
    @ApiOperationSupport(order = 3)
    @PostMapping("/wxqKickWhitelist/deleteById")
    public Object deleteWxqKickWhitelist(@RequestBody WxqKickWhitelistIdDto wxqKickWhitelistIdDto){
        wxqKickWhitelistService.deleteById(wxqKickWhitelistIdDto);
        return true;
    }

}
